As stated in the iconr package, any iconographic contents can be modeled with nodes linked together with edges. This tutorial explains how to construct this graph, a geometric graph, in a GIS before using the package. The chapter ‘Dataset’ of the iconr documentation can complete the present tutorial.
Detail of a Late Bronze Age stelae (Solana de Cabañas, Cáceres, Spain). Credits: Museo Arqueológico Nacional, Madrid
GIS offer multiple tools and options to facilitate the data entry. Here, we only look at the most basic ones but also point out the possible short cuts or good practices.
The image will be the reference space of the graph. So, before anything, start by opening the image decoration into a GIS (for example QGIS), or downloading the training decoration from GitHub
Whether it is not mandatory – and not available in all GIS – you can check the box Non projection (or unknown/non-Earth projection). The projection system will not affect the next step.
The image extent is measured in pixels with a top-left corner origin (0,0).
To retrieve to true scale of the decoration, you can create a scale bar and apply a simple rule of three to convert pixels into centimeters or meters. For example, if the scale belongs to another drawing, you can import it and ‘georeferenced’ it on the original drawing with the Freehand raster georeferencer plugin, and then create the scale bar
To retrieve the real dimensions of each GUs, first get the pixel sizes with the Measure line tools, then apply a simple rule of three with:
$length)At first, we have to create the data structures for the nodes and the edges. Like for the decoration image, the coordinates system of the nodes and edges are irrelevant: their coordinates are measured in pixels.
Nodes are created as a shapefile of POINTS. The attribute table of the nodes has at least four (4) fields:
site (Text)decor (Text)id (Integer)type (Text)The nodes are created near the centroids of each different graphical units (GUs). See the Node data part of the incor documentation
Edges are created as a shapefile of LINES and the edges table attributes is created in the same way as nodes. Edges attribute table has at least five (5) fields:
site (Text)decor (Text)a (Integer)b (Integer)type (Text)See the Edge data part of the incor documentation
In the GIS, add a node for each GUs and add an edge between two contiguous GUs
To understand the typology of the edges (field type), see the Edge types part of the incor documentation
For the Abela decoration, we have created three (3) nodes (1,2,3) and two (2) edges (1-=-2,1-=-2). We nammed the nodes shapefile nodes.shp and the edges shapefile edges.shp because this is their default name in the incor package
A dataframe, the table of decorations, record the joins between the node dataframe and the edge dataframe. This dataframe could be a .tsv (tabulate separated-values) or .csv (comma separated-values)
The table of decorations has four (4) mandatory fields:
idf (Integer)site (Text)decor (Text)img (Text)To understand the meaning of these fields, see the Table of decorations part of the incor documentation
The latest development version of the incor package and its vignette can be downloaded from GitHub
devtools::install_github("zoometh/iconr", build_vignettes=TRUE)
And load the package
library(iconr)
To start using the package, you have first to locate your working directory. For example:
dataDir <- "C:/Users/supernova/Dropbox/My PC (supernova-pc)/Documents/iconr/docs/tutorial/extdata"
The you can start with the function plot_dec_grph() and specifying the extensions of the nodes and edges data (shp)
# Decoration to be plotted
site <- "Abela"
decor <- "Abela"
# Read nodes, edges, and decorations
nds.df <- read_nds(site, decor, dataDir, format = "shp")
eds.df <- read_eds(site, decor, dataDir, format = "shp")
imgs <- read.table(paste0(dataDir, "/imgs.tsv"),
sep="\t", stringsAsFactors = FALSE, header = T)
# Save the plot of nodes and edges with node variable "type" as labels
# in png image format and return the image file name.
plot_dec_grph(nds.df, eds.df, imgs,
site, decor,
dir = dataDir,
nd.var = "type")
Abela stelae
Once you record all your dataset (nodes, edges, table of decoration and images), you can use the iconr package